#region File Header
//-----------------------------------------------------------------------------
// Bricks' Bane
//
// Copyright (C) 2010 Julien Villers
// This program is distributed under the terms of the 
// GNU Lesser General Public License (LGPL).
// See Docs/lgpl.txt and Docs/gpl.txt
//-----------------------------------------------------------------------------
#endregion

using BricksBane.Screens;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using SibLib;
using SibLib.GameState;
using SibLib.GameComponents;
using SibLib.Sound;

namespace BricksBane
{
    /// <summary>
    /// Entry point of the game.
    /// </summary>
    sealed public class BricksBaneGame : GameWithGSC
    {
        #region Fields

        GraphicsDeviceManager graphics;

        #endregion

        #region Initialization

        /// <summary>
        /// The main game constructor.1
        /// </summary>
        public BricksBaneGame()
        {
            Content.RootDirectory = "Content";

            graphics = new GraphicsDeviceManager(this);

            graphics.PreferredBackBufferWidth = 1280;
            graphics.PreferredBackBufferHeight = 720;
            graphics.SynchronizeWithVerticalRetrace = true;

            // Create the screen manager component.
            ScreenManager screenManager = new ScreenManager(this);

            // Activate the first screens.
            screenManager.AddScreen(new BackgroundScreen(), null);
            screenManager.AddScreen(new MainMenuScreen(), null);

            // Create the sound manager component.
            SoundManager soundManager = new SoundManager(this, "BricksBane");
        }

        protected override void Initialize()
        {
            base.Initialize();

            // Create the highscore component.
            // Note: must be done after GamerServicesComponent was added, in base.Initialize().
            HighscoreComponent highscore = new HighscoreComponent(this, null, "Bricks' Bane");
            Components.Add(highscore);
            highscore.Initialize();
            highscore.Enabled = true;
        }

        #endregion

        #region Draw


        /// <summary>
        /// This is called when the game should draw itself.
        /// </summary>
        protected override void Draw(GameTime gameTime)
        {
            graphics.GraphicsDevice.Clear(Color.Black);

            // The real drawing happens inside the screen manager component.
            base.Draw(gameTime);
        }


        #endregion
    }


    #region Entry Point

    /// <summary>
    /// The main entry point for the application.
    /// </summary>
    static class Program
    {
        static void Main()
        {
            SibLib.Program.Run<BricksBaneGame>();            
        }
    }

    #endregion
}
